import { get, post, uploadFile, downloadFile } from '@/http';

export function testGet(params = {}) {
  return get({
    url: '/testGet',
    params
  });
}

export function testNoAuth() {
  return get({
    url: '/401'
  });
}

export function testGetDynamicParams() {
  return get({
    url: `/get/李四/12`
  });
}

export function testPost(data = {}) {
  return post({
    url: '/post?a=1',
    data
  });
}

export function testUploadFile(data) {
  const formData = new FormData();
  Object.keys(data).forEach((key) => {
    formData.append(key, data[key]);
  });
  return uploadFile({
    url: '/upload',
    data: formData
  });
}

export function testDownloadFile() {
  return downloadFile({ url: '/download' });
}
